package com.hunan.yllxy.config;

import com.alibaba.druid.wall.WallConfig;
import com.alibaba.druid.wall.WallFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: 刘华
 * @Date: 2025/3/26 下午5:58
 * @Version 1.0
 */
@Configuration
public class DruidConfig {
    @Bean
    public WallFilter wallFilter(WallConfig wallConfig) {
        WallFilter wallFilter = new WallFilter();
        wallFilter.setConfig(wallConfig);
        return wallFilter;
    }

    @Bean
    public WallConfig wallConfig() {
        WallConfig wallConfig = new WallConfig();
        wallConfig.setNoneBaseStatementAllow(true); // 允许非基础 SQL 语句
        // 可选：其他安全规则（如 setSelectAllow、setCreateTableAllow 等）
        return wallConfig;
    }
}
